// PageHospInfo.cpp : implementation file
//

#include "stdafx.h"
#include "ECGWorkStation.h"
#include "PageHospInfo.h"
#include "..\public\pubfun\inireadwrite\inireadwrite.h"
#include "Globals.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPageHospInfo property page

IMPLEMENT_DYNCREATE(CPageHospInfo, CPropertyPage)

CPageHospInfo::CPageHospInfo() : CPropertyPage(CPageHospInfo::IDD)
{
	//{{AFX_DATA_INIT(CPageHospInfo)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

CPageHospInfo::~CPageHospInfo()
{
}

void CPageHospInfo::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageHospInfo)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageHospInfo, CPropertyPage)
	//{{AFX_MSG_MAP(CPageHospInfo)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageHospInfo message handlers

void CPageHospInfo::OnDestroy() 
{
	CPropertyPage::OnDestroy();
	
	((CEdit*)GetDlgItem(IDC_EDIT_NAME))->GetWindowText(m_strName);
	((CEdit*)GetDlgItem(IDC_EDIT_ADDRESS))->GetWindowText(m_strAddress);
	((CEdit*)GetDlgItem(IDC_EDIT_POSTCODE))->GetWindowText(m_strPostCode);
//	((CEdit*)GetDlgItem(IDC_EDIT_TEL))->GetWindowText(m_strTel);
	((CEdit*)GetDlgItem(IDC_EDIT_HOSPMEMO))->GetWindowText(m_strMemo);
	
}

BOOL CPageHospInfo::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	LoadSetting();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CPageHospInfo::SaveSetting(void)
{
	CIniReadWrite::GetMe()->SaveString(DEF_HOSP_INFO, DEF_HOSP_NAME, m_strName);
	CIniReadWrite::GetMe()->SaveString(DEF_HOSP_INFO, DEF_DEP_NAME, m_strAddress);
	CIniReadWrite::GetMe()->SaveString(DEF_HOSP_INFO, DEF_DR_NAME, m_strPostCode);
	CIniReadWrite::GetMe()->SaveString(DEF_HOSP_INFO, DEF_HOSP_MEMO, m_strMemo);
}

void CPageHospInfo::LoadSetting(void)
{
	CString strTemp = "";
	CIniReadWrite::GetMe()->LoadString(DEF_HOSP_INFO, DEF_HOSP_NAME, &strTemp);
	((CEdit*)GetDlgItem(IDC_EDIT_NAME))->SetWindowText(strTemp);strTemp = "";

	CIniReadWrite::GetMe()->LoadString(DEF_HOSP_INFO, DEF_DEP_NAME, &strTemp);
	((CEdit*)GetDlgItem(IDC_EDIT_ADDRESS))->SetWindowText(strTemp);strTemp = "";

	CIniReadWrite::GetMe()->LoadString(DEF_HOSP_INFO, DEF_DR_NAME, &strTemp);
	((CEdit*)GetDlgItem(IDC_EDIT_POSTCODE))->SetWindowText(strTemp);strTemp = "";

	CIniReadWrite::GetMe()->LoadString(DEF_HOSP_INFO, DEF_HOSP_MEMO, &strTemp);
	((CEdit*)GetDlgItem(IDC_EDIT_HOSPMEMO))->SetWindowText(strTemp);strTemp = "";
}
